WPS Office.apk(点击下载) / jbx.java


package defpackage;

import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Handler;
import android.text.TextUtils;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import cn.wps.moffice.OfficeApp;
import cn.wps.moffice.picstore.ext.PicItem;
import cn.wps.moffice.picstore.ext.PicStorePreviewActivity;
import cn.wps.moffice.provider.MofficeFileProvider;
import cn.wps.moffice_eng.R;
import com.google.gson.annotations.SerializedName;
import defpackage.dsa;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;

/* renamed from: jbx  reason: default package */
final class jbx implements jbw {
    boolean dxe = false;
    Bitmap inL;
    jaz ksA;
    boolean ksB = false;
    private c ksC = new c(this, (byte) 0);
    private b ksD = new b(this, (byte) 0);
    a ksE;
    private jbn ksu;
    protected Bitmap ksw;
    boolean ksx = false;
    PicStorePreviewActivity ksy;
    PicItem ksz;

    /* access modifiers changed from: package-private */
    /* renamed from: jbx$a */
    public class a {
        @SerializedName("orderby")
        public String heB;
        @SerializedName("direct")
        public String ksI;

        private a() {
        }

        /* synthetic */ a(jbx jbx, byte b) {
            this();
        }
    }

    /* renamed from: jbx$b */
    class b extends jbu {
        private b() {
        }

        /* synthetic */ b(jbx jbx, byte b) {
            this();
        }

        @Override // defpackage.jbv
        public final boolean cIJ() {
            Boolean cIz = this.ksu.cIz();
            return (cIz != null && cIz.booleanValue()) || jbx.this.cIQ();
        }
    }

    /* renamed from: jbx$c */
    class c extends jbv {
        private c() {
        }

        /* synthetic */ c(jbx jbx, byte b) {
            this();
        }

        @Override // defpackage.jbv
        public final boolean cIJ() {
            return jbx.this.cIQ();
        }
    }

    public jbx(PicStorePreviewActivity picStorePreviewActivity, PicItem picItem, jaz jaz) {
        this.ksy = picStorePreviewActivity;
        this.ksz = picItem;
        this.ksA = jaz;
        cIO();
        this.ksu = new jbn(this.ksy, this.ksA.cIi(), this.ksA.cIj()) {
            /* class defpackage.jbx.AnonymousClass1 */

            @Override // defpackage.jbn
            public final void ao(String str, boolean z) {
                jbx.this.ksz.mbUrl = str;
                jbx jbx = jbx.this;
                PicItem picItem = jbx.this.ksz;
                picItem.kqW = z ? 1 : 2;
                jbb.cIo().a(picItem, new WeakReference<>(new jba(picItem) {
                    /* class defpackage.jbx.AnonymousClass4 */
                    final /* synthetic */ PicItem ksH;

                    {
                        this.ksH = r2;
                    }

                    @Override // defpackage.jba
                    public final void begin() {
                        super.begin();
                        jbx.this.dxe = false;
                        jbx.this.ksA.showDialog(0);
                    }

                    @Override // defpackage.jba
                    public final void onError(Exception exc) {
                        super.onError(exc);
                        jbx.this.ksA.btx();
                    }

                    @Override // defpackage.jba
                    public final void onProgress(int i) {
                        super.onProgress(i);
                        if (!jbx.this.dxe) {
                            jbx.this.ksA.showDialog(i);
                        }
                    }

                    @Override // defpackage.jba
                    public final void sM(boolean z) {
                        if (!jbx.this.dxe) {
                            if (TextUtils.isEmpty(this.ksH.savePath)) {
                                jbx.this.ksy.setResult(0);
                                jbx.this.ksA.btx();
                                return;
                            }
                            jbx.this.ksA.showDialog(100);
                            Intent intent = new Intent();
                            intent.setData(MofficeFileProvider.bN(jbx.this.ksy, this.ksH.savePath));
                            jbx.this.ksy.U(intent);
                        }
                    }
                }));
            }

            @Override // defpackage.jbn
            public final CharSequence cIE() {
                double cIN = (double) jbx.this.cIN();
                return cIN > 0.0d ? "¥" + (((float) ((long) cIN)) / 100.0f) + OfficeApp.arx().getResources().getString(R.string.home_price_unit) : "0";
            }
        };
        jbn jbn = this.ksu;
        jbn.kse = this.ksC;
        jbn.kse.a(jbn);
        jbn.ksf = this.ksD;
        jbn.ksf.a(jbn);
        jbn.ksg = this.ksD;
        jbn.ksg.a(jbn);
        jbn.ksh = new jbo();
        jbn.ksh.a(jbn);
        jbn.ksi = new jbo();
        jbn.ksi.a(jbn);
        PicItem picItem2 = this.ksz;
        if (picItem2 != null) {
            dts dts = new dts();
            dts.id = picItem2.kqQ;
            dts.name = picItem2.title;
            dts.eew = picItem2.gDh;
            dts.eev = picItem2.mobanType;
            dts.ecJ = picItem2.ecJ;
            dts.eeC = picItem2.kqT;
            dts.eeB = picItem2.kqL;
            jbn.eeJ = dts;
            jbn.eeI = new dty(jbn.mActivity, jaw.kqF, jbn.eeJ);
        }
        jbn.ksm = new jbs() {
            /* class defpackage.jbx.AnonymousClass2 */

            @Override // defpackage.jbs
            public final void cIH() {
                jbx.this.ksx = false;
            }

            @Override // defpackage.jbs
            public final void cII() {
                jbx.this.ksA.cIk();
            }
        };
    }

    @Override // defpackage.jbw
    public final void Fn(int i) {
        new jbi().a(new jbg<jbl>(this.ksy.getLoaderManager()) {
            /* class defpackage.jbx.AnonymousClass6 */

            @Override // defpackage.jbg
            public final void a(jbh<jbl> jbh) {
                if (jbh != null) {
                    jbx.this.ksA.a(jbh.data);
                }
            }

            @Override // defpackage.jbg
            public final void sE(String str) {
                lvg.a(jbx.this.ksy, str, 1);
                jbx.this.ksA.a(null);
            }
        }, "https://docer.wps.cn/v3.php/api/search/similar_mb", true, "mb_app", new StringBuilder().append(jaw.kqF).toString(), "mb_id", this.ksz.kqQ, "keyword", this.ksz.title, "page", String.valueOf((i / 10) + 1), "per_page", "10", "file_type", "2", "orderby", this.ksE.heB, "order_direction", this.ksE.ksI, "mb_platform", "16");
    }

    @Override // defpackage.jbw
    public final void b(ImageView imageView, String str) {
        dsa cn2 = dry.bt(this.ksy).li(str).cn(R.drawable.internal_template_default_item_bg, -1);
        cn2.dYN = ImageView.ScaleType.FIT_XY;
        cn2.a(imageView, new dsa.a() {
            /* class defpackage.jbx.AnonymousClass3 */

            @Override // defpackage.dsa.a
            public final void a(String str, ImageView imageView, Bitmap bitmap) {
                jbx.this.ksz.kqP = new SoftReference<>(bitmap);
                jbx.this.ksB = true;
                jbx.this.ksw = bitmap;
                jbx.this.inL = bitmap;
                if (TextUtils.isEmpty(jbx.this.ksz.kqV)) {
                    new Handler().post(new Runnable() {
                        /* class defpackage.jbx.AnonymousClass3.AnonymousClass1 */

                        public final void run() {
                            jbx.this.cIO();
                        }
                    });
                }
            }
        });
    }

    @Override // defpackage.jbw
    public final void cIK() {
        if (this.ksB) {
            this.ksA.F(this.ksw);
        }
    }

    @Override // defpackage.jbw
    public final void cIL() {
        if (this.ksx) {
            this.ksu.cIC();
        }
    }

    @Override // defpackage.jbw
    public final jbn cIM() {
        return this.ksu;
    }

    public final int cIN() {
        try {
            return TextUtils.isEmpty(this.ksz.ecJ) ? this.ksu.eeK.aMg() : this.ksz.aMg();
        } catch (Exception e) {
            return 0;
        }
    }

    public final void cIO() {
        ImageView cIl;
        float f;
        if (this.ksA != null && (cIl = this.ksA.cIl()) != null) {
            try {
                PicItem picItem = this.ksz;
                if (TextUtils.isEmpty(picItem.kqV)) {
                    throw new IllegalArgumentException("wh is empty");
                }
                String[] split = picItem.kqV.split("\\*");
                if (split.length != 2) {
                    throw new IllegalArgumentException("wh length is illegal");
                }
                float floatValue = Float.valueOf(split[0]).floatValue();
                float floatValue2 = Float.valueOf(split[1]).floatValue();
                if (floatValue2 == 0.0f) {
                    throw new IllegalArgumentException("Height can't be zero");
                }
                f = floatValue / floatValue2;
                int gP = ((int) (((float) this.ksy.getResources().getConfiguration().screenWidthDp) * luf.gP(this.ksy))) - (luf.dip2px(this.ksy, 20.0f) << 1);
                int i = (int) (((float) gP) / f);
                ViewGroup.LayoutParams layoutParams = cIl.getLayoutParams();
                if (layoutParams == null) {
                    layoutParams = new LinearLayout.LayoutParams(gP, i);
                } else {
                    layoutParams.height = i;
                }
                cIl.setLayoutParams(layoutParams);
            } catch (Exception e) {
                Bitmap bitmap = this.inL;
                if (bitmap != null) {
                    f = ((float) bitmap.getWidth()) / ((float) bitmap.getHeight());
                }
            }
        }
    }

    public final void cIP() {
        this.ksE = new a(this, (byte) 0);
    }

    /* access modifiers changed from: package-private */
    public boolean cIQ() {
        try {
            return ((double) cIN()) <= 0.0d;
        } catch (Exception e) {
            return false;
        }
    }

    @Override // defpackage.jbw
    public final void cancelDownload() {
        this.dxe = true;
        jbb cIo = jbb.cIo();
        if (cIo.gSY != null && cIo.kri != null) {
            cIo.gSY.cPS = true;
            if (cIo.kri.exists()) {
                cIo.kri.delete();
            }
        }
    }

    @Override // defpackage.jbw
    public final void loadData() {
        new jbi().a(new jbg<a>(this.ksy.getLoaderManager()) {
            /* class defpackage.jbx.AnonymousClass5 */

            @Override // defpackage.jbg
            public final void a(jbh<a> jbh) {
                if (jbh == null || jbh.data == null) {
                    jbx.this.cIP();
                } else {
                    jbx.this.ksE = jbh.data;
                }
                jbx.this.Fn(0);
            }

            @Override // defpackage.jbg
            public final void sE(String str) {
                jbx.this.cIP();
                jbx.this.Fn(0);
            }
        }, "https://docer.wps.cn/v3.php/api/android/mb/picture/cate_order", false, "mb_app", String.valueOf(jaw.kqF));
    }

    @Override // defpackage.jbw
    public final void onConfigurationChanged() {
        cIO();
    }

    @Override // defpackage.jbw
    public final void sO(boolean z) {
        this.ksx = z;
    }
}